import axios from '../../plugins/axios.js'

const state = {
	user:{
		err:2,
		msg:'账号或密码错误',
		token:'',
		data:{}
	}
}

const actions = {
	user: async (state,commit,{_id,collectionName}={})=>{
		// let res = await axios.get(`/news/${colelctionName}/${_id}`)
		let {data} = await axios.get(`/user`)
	    // commit('user',res.data)
	    commit('user',data)
	}
}

const mutations = {
	user:(state,payload)=>{
		state.user=payload
	}
}

export default {
	namespaced:true,
	state,actions,mutations
}